package API.DAY8.thread;

public class SleepDemo2 {
    public static void main(String[] args) {
        Thread x = new Thread("x"){
            public void run(){
                Boolean a = true;
                try {
                    System.out.println(getName()+":发小蓝效果");

                    Thread.sleep(10000);
                } catch (InterruptedException e) {
                    System.out.println(getName()+":出生啊小蓝你都灰");
                    a=false;
                }
                if (a) {
                    System.out.println(getName()+":送墓三张牌");
                } else {
                    System.out.println(getName()+":玩儿不了一点");
                }
            }
        };
        Thread y = new Thread("y"){
            public void run(){
                System.out.println(getName()+":小蓝?灰了");
                try {
                    Thread.sleep(1000);

                } catch (InterruptedException e) {
                }
                System.out.println(getName()+":发不了效果了吧");
                x.interrupt();
            }
        };
        x.start();
        y.start();
    }
}
